<template>
<div class="addCard.vue-wrap">
    <G_header title="添加优惠券" />
    <van-cell-group>
        <van-field v-model="from.name" placeholder="请输入优惠券名称" label="名称" />
        <van-field v-model="from.conditionMoney" placeholder="请输入优惠条件金额" label="条件金额" />
        <van-field v-model="from.money" placeholder="请输入优惠金额" label="优惠金额" />
        <van-field v-model="from.number" placeholder="请输入优惠券数量" label="数量" />
        <van-field v-model="from.start_time" placeholder="请选择开始时间" clickable label="开始时间" @click-right-icon="getTime_start">
            <div slot="right-icon">
                <van-button type="primary" size="mini">选择</van-button>
            </div>
        </van-field>
        <van-field v-model="from.end_time" placeholder="请选择结束时间" clickable label="结束时间" @click-right-icon="getTime_end">
            <div slot="right-icon">
                <van-button type="primary" size="mini">选择</van-button>
            </div>
        </van-field>
    </van-cell-group>
    <van-button type="info" size="large">提交</van-button>
    <van-popup v-model="dateShow" position="buttom" :style="{ width:'100%' }">
        <van-datetime-picker v-model="currentDate" type="datetime" :min-date="minDate" :max-date="maxDate" @change="getTime" :confirm="time" />
    </van-popup>
</div>
</template>

<script>
export default {
    name: 'AddCardVue',
    data() {
        return {
            addTimeType: '',
            from: {
                name: null,
                conditionMoney: null,
                money: null,
                number: null,
                start_time: '',
                end_time: ''
            },
            minHour: 10,
            maxHour: 20,
            minDate: new Date(),
            maxDate: new Date(2020, 10, 1),
            currentDate: new Date(),
            dateShow: true,
            c_time: []
        }
    },
    methods: {
      addCard() {
            this.cardShow = true
        },
        getClose() {
            // this.cardShow = false
        },
        getTime(e){
            let arr = e.getValues();
            this.c_time = arr;
            this.from.start_time = `${arr[0]}年${arr[1]}月${arr[2]}日${arr[3]}时${arr[4]}分`
        },
        getTime_start(){
          console.log(12);
          
            this.dateShow = true;
            this.addTimeType = 'start'
        },
        getTime_end(){
            this.addTimeType = 'end'
            // this.dateShow= true
        },
        time(){

        }
    }
}
</script>

<style lang="less" scoped></style>
